﻿using System;
using System.Text;

namespace Prototype
{
    public class MessageBox : IProduct
    {
        private char decoder;

        public MessageBox(char decoder)
        {
            this.decoder = decoder;
        }


        #region IProduct メンバ

        public void Use(string s)
        {
            Encoding enc = Encoding.GetEncoding("shift_jis");
            int length = enc.GetByteCount(s);

            for (int i = 0; i < length + 4; i++)
            {
                Console.Write(decoder);
            }

            Console.WriteLine();
            Console.WriteLine(decoder + " " + s + " " + decoder);

            for (int i = 0; i < length + 4; i++)
            {
                Console.Write(decoder);
            }

            Console.WriteLine();
        }

        public IProduct CreateClone()
        {
            return (IProduct)MemberwiseClone();
        }

        #endregion
    }
}
